package com.swt.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.swt.service.PermissionService;
import com.swt.domain.Permission;
import com.swt.mapper.PermissionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 苏
* @description 针对表【yesapi_mall_ums_permission(电商-后台用户权限表)】的数据库操作Service实现
* @createDate 2022-05-16 15:21:33
*/
@Service
public class PermissionServiceImpl implements PermissionService {

    @Autowired
    private PermissionMapper permissionMapper;
    @Override
    public List<Permission> selectAllPermission() {
        return permissionMapper.selectList(null);
    }

    @Override
    public int delectPermission(String id) {
        return permissionMapper.deleteById(id);
    }

    @Override
    public int updatePermission(Permission Permission) {
        return permissionMapper.updateById(Permission);
    }

    @Override
    public int inserPermission(Permission Permission) {
        return permissionMapper.insert(Permission);
    }

    @Override
    public Permission selectbyPermission(String id) {
        return permissionMapper.selectById(id);
    }

    @Override
    public Page<Permission> pagePermission(Integer page, Integer start) {
        Page<Permission> userPge = new Page<>(page,start);
        return permissionMapper.selectPage(userPge,null);
    }
}




